<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__EXTEND__/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__EXTEND__/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__EXTEND__/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__EXTEND__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>菜单</title>
</head>
<body>
<article class="page-container">
    <form class="form form-horizontal" id="form-menu">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{{$info.title|default=''}}" placeholder="用于后台显示的配置标题" id="title" name="title">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>上级菜单：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <div class="select-box">
                    <select name="pid" class="select">
                        <option value="0">顶级菜单</option>
                        <foreach name="pids" item="pid">
                            <option value="{{$pid['m_id']}}" <if condition="$pid['m_id'] eq $info['pid']">selected</if>>{{:str_repeat("&nbsp;&nbsp;|--&nbsp;",$pid['level'])}}{{$pid['title']}}</option>
                        </foreach>
                    </select>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>规则：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{{$info.url|default=''}}" placeholder="U函数解析的URL或者外链/如果是顶级菜单则填写标题" id="url" name="url">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>规则类型：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="is_menu" type="radio" id="menu-1"  value="1" <if condition="$info['is_menu'] eq 1">checked</if>>
                    <label for="menu-1">菜单</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="menu-0" name="is_menu" value="0" <if condition="$info['is_menu'] neq 1">checked</if>>
                    <label for="menu-0">动作</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否隐藏：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="hide" type="radio" id="hide-0"  value="1" <if condition="$info['hide'] eq 1">checked</if>>
                    <label for="hide-0">是</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="hide-1" name="hide" value="0" <if condition="$info['hide'] neq 1">checked</if>>
                    <label for="hide-1">否</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>仅开发者模式可见：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    <input name="is_dev" type="radio" id="dev-0"  value="1" <if condition="$info['is_dev'] eq 1">checked</if>>
                    <label for="dev-0">是</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="dev-1" name="is_dev" value="0" <if condition="$info['is_dev'] neq 1">checked</if>>
                    <label for="dev-1">否</label>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">图标：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入显示图标" id="icon" name="icon">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">排序：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{{$info.sort|default=0}}" placeholder="用于菜单分组显示的顺序" id="sort" name="sort">
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3">说明：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{{$info.tip|default=''}}" placeholder="菜单详细说明" id="tip" name="tip">
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input type="hidden" name="m_id" value="{{$info.m_id|default=''}}">
                <!--<input type="hidden" name="hide" value="0">-->
                <!--<input type="hidden" name="is_dev" value="0">-->
                <input class="btn btn-warning radius" type="submit" value="&nbsp;&nbsp;确定&nbsp;&nbsp;">
                <input class="btn btn-default radius" type="reset" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__EXTEND__/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="__EXTEND__/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="__EXTEND__/static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__EXTEND__/lib/jquery.validation/1.14.0/messages_zh.js"></script>

<script type="text/javascript">
    $("#icon").val("{{$info.icon}}");
    $(function(){
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form-menu").validate({
            rules:{
                title:{
                    required:true,
                },
                pid:{
                    required:true,
                },
                hide:{
                    required:true,
                },
                is_dev:{
                    required:true,
                },
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "{{:U('')}}" ,
                    success: function(data){
                        if(data.status){
                            layer.msg(data.info,{icon:6,time:1000});
                            setTimeout((function() {
                                parent.window.location.href="{{:U('Admin/AuthManager/authList')}}";
                            }), 1500);
                        }else{
                            layer.msg(data.info,{icon:6,time:1000});
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer.msg('error!',{icon:5,time:1000});
                    }
                });
            }
        });
    });
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>